package com.jrzh.mvc.search.sys;

import org.apache.commons.lang.StringUtils;

import com.jrzh.framework.base.search.BaseSearch;
import com.jrzh.framework.searchutils.Criteria;
import com.jrzh.framework.searchutils.Restrictions;

public class FileSearch extends BaseSearch{
	private static final long serialVersionUID = 1L;
	
	private String equalModel;
	private String equalFormId;
	private String equalMemberId;
	private String likeName;
	private String eqKey;
	private String[] inUrls;
	private String eqUrl;
	private String inEqualFormId;
	
	
	public String getInEqualFormId() {
		return inEqualFormId;
	}

	public void setInEqualFormId(String inEqualFormId) {
		this.inEqualFormId = inEqualFormId;
	}

	public String getEqKey() {
		return eqKey;
	}

	public void setEqKey(String eqKey) {
		this.eqKey = eqKey;
	}

	public String getEqualModel() {
		return equalModel;
	}

	public void setEqualModel(String equalModel) {
		this.equalModel = equalModel;
	}

	public String getEqualFormId() {
		return equalFormId;
	}

	public void setEqualFormId(String equalFormId) {
		this.equalFormId = equalFormId;
	}

	public String getEqUrl() {
		return eqUrl;
	}

	public void setEqUrl(String eqUrl) {
		this.eqUrl = eqUrl;
	}

	public String getEqualMemberId() {
		return equalMemberId;
	}

	public void setEqualMemberId(String equalMemberId) {
		this.equalMemberId = equalMemberId;
	}

	@Override
	public void setCriterias(Criteria<?> criterias) {
		if(StringUtils.isNotBlank(equalFormId)){
			criterias.add(Restrictions.eq("formId", equalFormId));
		}
		if(StringUtils.isNotBlank(inEqualFormId)){
			criterias.add(Restrictions.in("formId", inEqualFormId));
		}
		if(StringUtils.isNotBlank(equalMemberId)){
			criterias.add(Restrictions.eq("memberId", equalMemberId));
		}
		if(StringUtils.isNotBlank(equalModel)){
			criterias.add(Restrictions.eq("model", equalModel));
		}
		if(StringUtils.isNotBlank(likeName)){
			criterias.add(Restrictions.like("name", likeName+"%"));
		}
		if(StringUtils.isNotBlank(eqKey)){
			criterias.add(Restrictions.eq("key", eqKey));
		}
		if(null != inUrls && inUrls.length > 0){
			criterias.add(Restrictions.in("url", inUrls));
		}
		if(StringUtils.isNotBlank(eqUrl)){
			criterias.add(Restrictions.eq("url", eqUrl));
		}
	}

	public String getLikeName() {
		return likeName;
	}

	public void setLikeName(String likeName) {
		this.likeName = likeName;
	}

	public String[] getInUrls() {
		return inUrls;
	}

	public void setInUrls(String[] inUrls) {
		this.inUrls = inUrls;
	}

}